import sys
import clutter

font_color = clutter.color_parse("Black")
font_name = "Mono 32"
back_color = clutter.color_parse("White")
box_back_color = clutter.color_parse("Grey")


class Domos:
    def __init__ (self):
        self.stage = clutter.Stage()
        self.stage.show()
        #self.stage.set_fullscreen(True)
        self.stage.set_color(back_color)
        self.stage.set_size(1366, 768)
        self.stage.set_title('Domos launcher')
        self.stage.connect('key-press-event', clutter.main_quit)

    def run(self):
        self.stage.show_all()
        clutter.main()

    def add(self, actor):
        self.stage.add(actor)
    
def main (args):
    app = Domos()

    from mpd_cli import MpdController
    m = MpdController()
    m.show()

    from transilien import HorairesDisplayer
    h = HorairesDisplayer()
    h.set_position(m.get_width()+20, 0)
    h.show()

    from webradio import WebRadiosDisplayer
    w = WebRadiosDisplayer()
    w.show()
    w.set_position(m.get_width()+20+h.get_width()+20, 0)

    from rss import RSSDisplayer
    r = RSSDisplayer()
    x, y  = w.get_position()
    r.set_position(x + w.get_width() + 20, 0)

    app.add(m)
    app.add(h)
    app.add(w)
    app.add(r)
    app.run()
    return 0

if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))
